package com.zhejiangzhengyuan.municipal_common.utils;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * @author lin_ju
 * @create on 2019/11/22
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ConstantUtil {
  public static final String HEADER_AUTHORIZATION = "Authorization";

  public static class HTTP_CODE {
    // 供参数验证使用
    public static final int OK = 200;
    public static final int CLIENT_PARAM_ERROR = 400;
  }

  public enum ResultCode {
    // 常用httpRequest
    SUCCESS(200, "操作成功"),
    CLIENT_PARAM_ERROR(400, "客户端参数错误"),
    UN_AUTHORIZED(401, "Unauthorized"),
    FORBIDDEN(403, "Forbidden"),
    NOT_FOUND_PATH(404, "没有找到页面"),
    SERVER_ERROR(500, "服务器异常"),

    // 业务自定义状态码
    NOT_FOUND_RESOURCES(4004, "没有找到资源");

    // http状态码
    int code;

    // 操作提示信息
    String message;

    ResultCode(int code, String message) {
      this.code = code;
      this.message = message;
    }

    public int code() {
      return code;
    }

    public String message() {
      return message;
    }
  }

  public static class DEVICE_TYPE {
    public static String FLOODED_ROAD = "道路积水设备";
    public static String PUMPING_STATION = "泵站设备";
    public static String SEWAGE = "雨污混排设备";
    public static String WAY = "一路一档设备";
    public static String MANHOLE_COVER = "井盖设备";
  }

  public static class MODULE_NAME {
    public static String FLOODED_ROAD = "municipal_flooded_road";
    public static String PUMPING_STATION = "municipal_pumping_station";
    public static String SEWAGE = "municipal_sewage";
    public static String WAY = "municipal_way";
    public static String MANHOLE_COVER = "municipal_manhole_cover";
  }

  public static class WARN_TYPE {
    public static String FLOODED_ROAD = "道路积水告警";
    public static String PUMPING_STATION = "泵站告警";
    public static String SEWAGE = "雨污混排告警";
    public static String WAY = "一路一档告警";
    public static String MANHOLE_COVER = "井盖告警";
  }

  public static class WARN_DATA_ORIGIN {
    public static String SYSTEM = "系统告警";
    public static String PC = "人工上报";
    public static String MOBILE = "移动端上报";
  }

  public static class WARN_VALUE {
    public static String JG_STATIC = "1";
    public static String SW_STATIC = "1";
  }

  public static String getModuleChineseName(String moduleName) {
    switch (moduleName) {
      case "municipal_flooded_road":
        return "道路积水系统";
      case "municipal_pumping_station":
        return "泵站管理系统";
      case "municipal_sewage":
        return "雨污混排系统";
      case "municipal_way":
        return "一路一档系统";
      case "municipal_manhole_cover":
        return "井盖管理系统";
        case "municipal_bi":
        return "市政大数据展示平台";
      default:
        return null;
    }
  }

  static String getActionMethod(String httpMethod) {
    String result = "";
    switch (httpMethod.toLowerCase()) {
      case "get":
        result = "查看";
        break;
      case "post":
      case "put":
        result = "操作";
        break;
      case "delete":
        result = "删除";
        break;
    }
    return result;
  }
}
